<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../style.css" type="text/css" media="screen">
<link rel="stylesheet" href="../print.css" type="text/css" media="print">
<meta content="Routes,routes.Routes,addRoute,addRoutes,dispatchEvent,hasRegistration,hasRoute,listRegistrations,register,removeRoute,retrieve,routeEvent,unregister" name="keywords">
<title>routes.Routes</title>
</head>
<body>
<script type="text/javascript" language="javascript" src="../asdoc.js"></script><script type="text/javascript" language="javascript" src="../cookies.js"></script><script type="text/javascript" language="javascript">
<!--
				asdocTitle = 'Routes - API Documentation';
				var baseRef = '../';
				window.onload = configPage;
			--></script>
<table style="display:none" id="titleTable" cellspacing="0" cellpadding="0" class="titleTable">
<tr>
<td align="left" class="titleTableTitle">API Documentation</td><td align="right" class="titleTableTopNav"><a onclick="loadClassListFrame('../all-classes.html')" href="../package-summary.html">All&nbsp;Packages</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../all-classes.html')" href="../class-summary.html">All&nbsp;Classes</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../index-list.html')" href="../all-index-A.html">Index</a>&nbsp;|&nbsp;<a href="../index.html?routes/Routes.html&amp;routes/class-list.html" id="framesLink1">Frames</a><a onclick="parent.location=document.location" href="" style="display:none" id="noFramesLink1">No&nbsp;Frames</a></td><td rowspan="3" align="right" class="titleTableLogo"><img alt="Adobe Logo" title="Adobe Logo" class="logoImage" src="../images/logo.jpg"></td>
</tr>
<tr class="titleTableRow2">
<td align="left" id="subTitle" class="titleTableSubTitle">Class&nbsp;Routes</td><td align="right" id="subNav" class="titleTableSubNav"><a href="#methodSummary">Methods</a></td>
</tr>
<tr class="titleTableRow3">
<td colspan="2">&nbsp;</td>
</tr>
</table>
<script type="text/javascript" language="javascript">
<!--
if (!isEclipse() || window.name != ECLIPSE_FRAME_NAME) {titleBar_setSubTitle("Class Routes"); titleBar_setSubNav(false,false,false,false,false,false,true,false,false,false,false,false,false,false);}
--></script>
<div class="MainContent">
<table cellspacing="0" cellpadding="0" class="classHeaderTable">
<tr>
<td class="classHeaderTableLabel">Package</td><td><a onclick="javascript:loadClassListFrame('class-list.html')" href="package-detail.html">routes</a></td>
</tr>
<tr>
<td class="classHeaderTableLabel">Class</td><td class="classSignature">public class Routes</td>
</tr>
</table>
<p></p>
  The routes.Routes class is a generic application event bus enabling 
  loosely coupled applications to communicate internally entirely via 
  events.
  
  <p>Routes makes no MVC assumptions or any impositions on how an 
  application is organized or broken into components -- each application 
  is free to slice and dice itself as is best for its specific case. 
  Niether are there any Inversion of Control impositions -- it is up to 
  each View to update itself internally as it knows best, all it needs 
  is to be alerted when affecting changes occur elsewhere in the system.</p>
  
  <p>An application may define any number of <em>routes</em> for any event type.
  An event route defines a <b>logical connection</b> between an event 
  type and a <b>handler descriptor</b>. Multiple routes may be specified 
  for any single event type -- each route is processed in sequence, by 
  dynamically resolving the targeted component+handler and invoking it. 
  This also means the component registered under a name may be changed 
  at any time e.g. a name such as <code>confirmationPopup</code> may be 
  reset any number of times to the confirmation popup that is active at
  any given time.</p> 
  
  <p>Event routes themselves may also be added or removed dynamically.</p>  
  
  <p>Routes will handle events of any kind. However, for the convenience of 
  not having to define numerous custom classes, the companion open-ended
  ApplicationEvent class is provided: it allows arbitrary keyed data 
  items to be attached to an event. But note that the Routes and 
  ApplicationEvent classes are completely independent of each other; 
  neither is aware of the existence of the other.</p> 
  
  <p>Events may be dispatched by any UI Component (they must be set to 
  bubble) or centrally via <code>routes.dispatchEvent()</code>. 
  In all cases, the resolved handler will receive the dispatched event 
  as the only argument.</p>  
  
  <p>To use routes, a Flex application should create a Routes instance and,
  ideally, make it available globally. Large multi-layered applications 
  may choose to employ multiple distinct Routes instances, where each 
  one may define a <em>communciation channel</em>.</p>   
  
  <p>A component, to be the <em>target</em> of a route, needs to be 
  registered, typically with: 
  <code>routes.register(componentName, this)</code. 
  However, components do not need to be registered to dispatch events.
  </p>
  <p></p>
<br>
<hr>
</div>
<a name="methodSummary"></a>
<div class="summarySection">
<div class="summaryTableTitle">Public Methods</div>
<table id="summaryTableMethod" class="summaryTable " cellpadding="3" cellspacing="0">
<tr>
<th>&nbsp;</th><th colspan="2">Method</th><th class="summaryTableOwnerCol">Defined&nbsp;by</th>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#Routes()">Routes</a>(gDispatcher:EventDispatcher = null, gContainer:EventDispatcher = null)</div>
<div class="summaryTableDescription"></div>
</td><td class="summaryTableOwnerCol">Routes</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#addRoute()">addRoute</a>(eventType:String, registeredKey:String, callableName:String):void</div>
<div class="summaryTableDescription">
   Process a (eventType, objectName, methodName) tuple to add
   (a) the generic routing listener for eventType and 
   (b) a route to own private routeMap for eventType.</div>
</td><td class="summaryTableOwnerCol">Routes</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#addRoutes()">addRoutes</a>(routes:Array):void</div>
<div class="summaryTableDescription">
   Add a list of routes -- Convenience wrapper on addRoute().</div>
</td><td class="summaryTableOwnerCol">Routes</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#dispatchEvent()">dispatchEvent</a>(event:Event):Boolean</div>
<div class="summaryTableDescription">
   Central event dispatcher, may be used from anywhere within the 
   application, in particular by non-IEventDispatcher objects.</div>
</td><td class="summaryTableOwnerCol">Routes</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#hasRegistration()">hasRegistration</a>(key:String):Boolean</div>
<div class="summaryTableDescription"> 
   Is <code>key</code> registered?
   </div>
</td><td class="summaryTableOwnerCol">Routes</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#hasRoute()">hasRoute</a>(eventType:String, registeredKey:String, callableName:String):Boolean</div>
<div class="summaryTableDescription">
   Check if the specified route is in the routeMap.</div>
</td><td class="summaryTableOwnerCol">Routes</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#listRegistrations()">listRegistrations</a>():String</div>
<div class="summaryTableDescription">
   Return a string listing of the registry.</div>
</td><td class="summaryTableOwnerCol">Routes</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#register()">register</a>(key:String, value:Object):void</div>
<div class="summaryTableDescription"> 
   Register <code>value</code> under <code>key</code>.</div>
</td><td class="summaryTableOwnerCol">Routes</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#removeRoute()">removeRoute</a>(eventType:String, registeredKey:String, callableName:String):void</div>
<div class="summaryTableDescription">
   Remove a previously added route.</div>
</td><td class="summaryTableOwnerCol">Routes</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#retrieve()">retrieve</a>(key:String):Object</div>
<div class="summaryTableDescription"> 
   Get the value registered under <code>key</code>.</div>
</td><td class="summaryTableOwnerCol">Routes</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#routeEvent()">routeEvent</a>(event:Event):void</div>
<div class="summaryTableDescription">
   Generic event listener as event routing mediator
   </div>
</td><td class="summaryTableOwnerCol">Routes</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#unregister()">unregister</a>(key:String):void</div>
<div class="summaryTableDescription"> 
   Unregister <code>key</code>.</div>
</td><td class="summaryTableOwnerCol">Routes</td>
</tr>
</table>
</div>
<script type="text/javascript" language="javascript">
<!--
showHideInherited();
--></script>
<div class="MainContent">
<a name="constructorDetail"></a>
<div class="detailSectionHeader">Constructor detail</div>
<a name="Routes()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">Routes</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">constructor</td>
</tr>
</table>
<div class="detailBody">
<code>public function Routes(gDispatcher:EventDispatcher = null, gContainer:EventDispatcher = null)</code><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">gDispatcher</span>:EventDispatcher</code> (default = <code>null</code>)<code></code></td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">gContainer</span>:EventDispatcher</code> (default = <code>null</code>)<code></code></td>
</tr>
</table>
</div>
<a name="methodDetail"></a>
<div class="detailSectionHeader">Method detail</div>
<a name="addRoute()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">addRoute</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td>
</tr>
</table>
<div class="detailBody">
<code>public function addRoute(eventType:String, registeredKey:String, callableName:String):void</code><p>
   Process a (eventType, objectName, methodName) tuple to add
   (a) the generic routing listener for eventType and 
   (b) a route to own private routeMap for eventType. 
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">eventType</span>:String</code></td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">registeredKey</span>:String</code></td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">callableName</span>:String</code></td>
</tr>
</table>
</div>
<a name="addRoutes()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">addRoutes</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function addRoutes(routes:Array):void</code><p>
   Add a list of routes -- Convenience wrapper on addRoute(). 
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">routes</span>:Array</code></td>
</tr>
</table>
</div>
<a name="dispatchEvent()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">dispatchEvent</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function dispatchEvent(event:Event):Boolean</code><p>
   Central event dispatcher, may be used from anywhere within the 
   application, in particular by non-IEventDispatcher objects.  
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">event</span>:Event</code></td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>Boolean</code></td>
</tr>
</table>
</div>
<a name="hasRegistration()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">hasRegistration</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function hasRegistration(key:String):Boolean</code><p> 
   Is <code>key</code> registered?
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">key</span>:String</code></td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>Boolean</code></td>
</tr>
</table>
</div>
<a name="hasRoute()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">hasRoute</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function hasRoute(eventType:String, registeredKey:String, callableName:String):Boolean</code><p>
   Check if the specified route is in the routeMap.
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">eventType</span>:String</code></td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">registeredKey</span>:String</code></td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">callableName</span>:String</code></td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>Boolean</code></td>
</tr>
</table>
</div>
<a name="listRegistrations()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">listRegistrations</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function listRegistrations():String</code><p>
   Return a string listing of the registry. 
   </p><p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>String</code></td>
</tr>
</table>
</div>
<a name="register()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">register</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function register(key:String, value:Object):void</code><p> 
   Register <code>value</code> under <code>key</code>. 
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">key</span>:String</code></td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">value</span>:Object</code></td>
</tr>
</table>
</div>
<a name="removeRoute()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">removeRoute</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function removeRoute(eventType:String, registeredKey:String, callableName:String):void</code><p>
   Remove a previously added route.
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">eventType</span>:String</code></td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">registeredKey</span>:String</code></td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">callableName</span>:String</code></td>
</tr>
</table>
</div>
<a name="retrieve()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">retrieve</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function retrieve(key:String):Object</code><p> 
   Get the value registered under <code>key</code>.
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">key</span>:String</code></td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>Object</code> &mdash; null if nothing had been previously stored for "key".
   </td>
</tr>
</table>
</div>
<a name="routeEvent()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">routeEvent</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function routeEvent(event:Event):void</code><p>
   Generic event listener as event routing mediator
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">event</span>:Event</code></td>
</tr>
</table>
</div>
<a name="unregister()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">unregister</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function unregister(key:String):void</code><p> 
   Unregister <code>key</code>.
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">key</span>:String</code></td>
</tr>
</table>
</div>
<br>
<br>
<hr>
<br>
<p></p>
<center class="copyright"> 
</center>
</div>
</body>
</html>
<!-- -->
